//
//  GJFTitleTableViewCell.m
//  Wedding
//
//  Created by 郭静芬 on 2017/1/9.
//  Copyright © 2017年 郭静芬. All rights reserved.
//

#import "GJFTitleTableViewCell.h"

@interface GJFTitleTableViewCell ()
@property (nonatomic, strong) UIImageView *imageUser;
@property (nonatomic, strong) UILabel *labelTitle;
@property (nonatomic, strong) UILabel *labelNum;
@end

@implementation GJFTitleTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}
- (void)setCaseDetailTitleModel:(GJFInspirationModel *)caseDetailTitleModel {
    _caseDetailTitleModel = caseDetailTitleModel;
    [self.imageUser sd_setImageWithURL:[NSURL URLWithString:caseDetailTitleModel.merchant.avatar]];
    self.labelTitle.text = caseDetailTitleModel.merchant.nickname;
    self.labelNum.text = [NSString stringWithFormat:@"%ld个案例", caseDetailTitleModel.merchant.myCase.count];
}
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.imageUser.frame = CGRectMake(15, 10, 50, 50);
    self.labelTitle.frame = CGRectMake(self.imageUser.frame.size.width + self.imageUser.frame.origin.x + 20, 20, WIDTH / 2, 30);
    self.labelNum.frame = CGRectMake(WIDTH - 60, self.contentView.frame.size.height / 3, 60, 20);
}

- (UIImageView *)imageUser {
    if (!_imageUser) {
        _imageUser = [[UIImageView alloc] init];
        _imageUser.layer.borderWidth = 2;
        _imageUser.layer.borderColor = HOMECOLOR.CGColor;
        _imageUser.layer.cornerRadius = 25;
        _imageUser.clipsToBounds = YES;
        [self.contentView addSubview:_imageUser];
    }
    return _imageUser;
}
- (UILabel *)labelTitle {
    if (!_labelTitle) {
        _labelTitle = [[UILabel alloc] init];
        _labelTitle.font = [UIFont systemFontOfSize:19 * XX];
        [self.contentView addSubview:_labelTitle];
    }
    return _labelTitle;
}
- (UILabel *)labelNum {
    if (!_labelNum) {
        _labelNum = [[UILabel alloc] init];
        _labelNum.font = [UIFont systemFontOfSize:11 * XX];
        _labelNum.textColor = [UIColor darkGrayColor];
        [self.contentView addSubview:_labelNum];
    }
    return _labelNum;
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
